<%@page import="support.*, java.util.*" %>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Degrees - More Degrees</title>
</head>
<body>
    <!-- Book keeping for degree -->
    <%
      // get discipline and process based on radio or text box submit
      String discipline = request.getParameter("discipline");
      if(discipline.equals("other")){
          discipline = request.getParameter("otherdiscipline");
      }
      // get previously submitted data and put into local variables
      String monthAwarded = request.getParameter("monthAwarded");
      String yearAwarded = request.getParameter("yearAwarded");
      String gpa = request.getParameter("gpa");
      String title = request.getParameter("title");
      // add everything to the current degree hashed set
      LinkedHashSet<String> currentDegree = (LinkedHashSet<String>)session.getAttribute("currentDegree");
      currentDegree.add(discipline);
      currentDegree.add(monthAwarded);
      currentDegree.add(yearAwarded);
      currentDegree.add(gpa);
      currentDegree.add(title);
      
      // add the current Degree hashed set to the set of all the degrees
      LinkedHashSet degrees = (LinkedHashSet)session.getAttribute("degrees");
      degrees.add(currentDegree);
      
      // create iterator to go through/display all the degrees
      Iterator it = degrees.iterator();
      while(it.hasNext()){
          out.print(it.next());
          out.print("<br>");
      }
    %>

    <br>
    
    Do you want to submit more Degrees? <br>
    
    <!-- Buttons to submit more degrees or cancel -->
    <form action="degree.jsp">
        <input type="submit" value="Submit Next Degree">
    </form>
    <form action="specialization.jsp">
        <input type="submit" value="Done">
    </form>
    
</body>
</html>